package {
	import mz.behaveas.model.ducktype.arraysAreEqual;
	import mz.behaveas.model.ducktype.Duck;
	import flash.display.Sprite;
	
/**
 * @author maxim.zaks@gmail.com
 */
public const arraysAreEqualSpec : Object = {
		description: "This specification describes araysAreEqual function",
		expectations: [
			{
				description:"Exception is throwen if first argument is not an array",
				behaviour : function():*{
					var a1 : * = 12;
					return arraysAreEqual(a1,[]);
				},
				shouldThrow : TypeError
			},
			{
				description:"Exception is throwen if second argument is not an array",
				behaviour : function():*{
					var a2 : * = 12;
					return arraysAreEqual([],a2);
				},
				shouldThrow : TypeError
			},
			{
				description:"Exception is throwen if both argument are not an array",
				behaviour : function():*{
					var a1 : * = 12;
					var a2 : * = 12;
					return arraysAreEqual(a1,a2);
				},
				shouldThrow : TypeError
			},
			{
				description:"Both argument are 1,2,3 array",
				behaviour : function():*{
					var a1 : Array = [1,2,3];
					var a2 : Array = [1,2,3];
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : true
			},
			{
				description:"First argument is 1,2,3 array, second is 3,2,1 array",
				behaviour : function():*{
					var a1 : Array = [1,2,3];
					var a2 : Array = [3,2,1];
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : false
			},
			{
				description:"First argument is a,b,c array, second is a,b,c array",
				behaviour : function():*{
					var a1 : Array = ['a', 'b', 'c'];
					var a2 : Array = ['a', 'b', 'c'];
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : true
			},
			{
				description:"First array is a and second is a,b. So first array is a subset of second array",
				behaviour : function():*{
					var a1 : Array = ['a'];
					var a2 : Array = ['a', 'b'];
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : false
			},
			{
				description:"First array is a,b and second is a. So second array is a subset of first array",
				behaviour : function():*{
					var a1 : Array = ['a', 'b'];
					var a2 : Array = ['a'];
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : false
			},
			{
				description:"First array is associatve array a:1 and second array is equal to it",
				behaviour : function():*{
					var a1 : Array = new Array();
					a1["a"] = 1;
					var a2 : Array = new Array();
					a2["a"] = 1;
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : true
			},
			{
				description:"First array is associatve array a:1 and second array is a:2",
				behaviour : function():*{
					var a1 : Array = new Array();
					a1["a"] = 1;
					var a2 : Array = new Array();
					a2["a"] = 2;
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : false
			},
			{
				description:"First array is associatve array a:1 and second array is b:1",
				behaviour : function():*{
					var a1 : Array = new Array();
					a1["a"] = 1;
					var a2 : Array = new Array();
					a2["b"] = 1;
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : false
			},
			{
				description:"First array is associatve array a:1 and second array is a:1,b:1",
				behaviour : function():*{
					var a1 : Array = new Array();
					a1["a"] = 1;
					var a2 : Array = new Array();
					a2["a"] = 1;
					a2["b"] = 1;
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : false
			},
			{
				description:"First array is associatve array a:1,b:1 and second array is a:1",
				behaviour : function():*{
					var a1 : Array = new Array();
					a1["a"] = 1;
					a1["b"] = 1;
					var a2 : Array = new Array();
					a2["a"] = 1;
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : false
			},
			{
				description:"First array is mixed array 1,a:1 and second array is a:1",
				behaviour : function():*{
					var a1 : Array = [1];
					a1["a"] = 1;
					var a2 : Array = [];
					a2["a"] = 1;
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : false
			},
			{
				description:"First array is mixed array 1,a:1 and second array is 2,a:1",
				behaviour : function():*{
					var a1 : Array = [1];
					a1["a"] = 1;
					var a2 : Array = [2];
					a2["a"] = 1;
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : false
			},
			{
				description:"First array is mixed array 1,a:1 and second array is 1,a:1",
				behaviour : function():*{
					var a1 : Array = [1];
					a1["a"] = 1;
					var a2 : Array = [1];
					a2["a"] = 1;
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : true
			},
			{
				description:"First array is mixed array 1,2,a:1 and second array is 1,a:1",
				behaviour : function():*{
					var a1 : Array = [1,2];
					a1["a"] = 1;
					var a2 : Array = [1];
					a2["a"] = 1;
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : false
			},
			{
				description:"First array is mixed array 1,a:1 and second array is 1,2,a:1",
				behaviour : function():*{
					var a1 : Array = [2];
					a1["a"] = 1;
					var a2 : Array = [1,2];
					a2["a"] = 1;
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : false
			},
			{
				description:"First array is 2d array [1],[2] and second is the same",
				behaviour : function():*{
					var a1 : Array = [[1], [2]];
					var a2 : Array = [[1], [2]];
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : true
			},
			{
				description:"First array is 2d array [1],[2] and second is 2d array [2],[1]",
				behaviour : function():*{
					var a1 : Array = [[1], [2]];
					var a2 : Array = [[2], [1]];
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : false
			},
			{
				description:"First array is 2d array [1,2],[2] and second is 2d array [1,2],[2]",
				behaviour : function():*{
					var a1 : Array = [[1,2], [2]];
					var a2 : Array = [[1,2], [2]];
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : true
			},
			{
				description:"First array is 2d array [2],[1,2] and second is 2d array [1,2],[2]",
				behaviour : function():*{
					var a1 : Array = [[2], [1,2]];
					var a2 : Array = [[1,2], [2]];
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : false
			},
			{
				description:"First array is 3d array [1],[2],[3] and second is the same",
				behaviour : function():*{
					var a1 : Array = [[1], [2], [3]];
					var a2 : Array = [[1], [2], [3]];
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : true
			},
			{
				description:"First array is 3d array [1],[3],[3] and second is 3d array [1],[2],[3]",
				behaviour : function():*{
					var a1 : Array = [[1], [3], [3]];
					var a2 : Array = [[1], [2], [3]];
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : false
			},
			{
				description:"First array is array Sprite() and second is array Duck({_type_:Sprite})",
				behaviour : function():*{
					var a1 : Array = [new Sprite()];
					var a2 : Array = [new Duck({_type_:Sprite})];
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : true
			},
			{
				description:"First array is array Duck({_type_:Sprite}) and second is array Sprite()",
				behaviour : function():*{
					var a1 : Array = [new Duck({_type_:Sprite})];
					var a2 : Array = [new Sprite()];
					return arraysAreEqual(a1,a2);
				},
				shouldEqual : true
			}
		]
	};
}
